/**
 * Created by Administrator on 2017/4/1 0001.
 */
import React from "react";
import {Checkbox} from 'antd';
export default class PeopleDetail extends React.Component{
    constructor(props){
        super(props);
        this.state={
            ischeck:false
        }
        this.int =1
    }

    componentWillMount(){

    }

    chose(){
        this.setState({
            ischeck:true
        });
        this.int = 0
    }

    unchose(){
        this.setState({
            ischeck:false
        });
        this.int = 1
    }

    checkchange(e){
        let is = e.target.checked;
        if(is){
            this.setState({
                ischeck:true,
            });
            this.int = 0
        }else{
            this.setState({
                ischeck:false,
            });
            this.int = 1
        }

        this.props.ischeckall(this.props.context);
    }


    render(){
        let context = this.props.context;
        switch (this.props.ordertype_num){
            case '1':
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num "><Checkbox ref={'checkall'} onChange={this.checkchange.bind(this)} checked={this.state.ischeck}/></td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.productName||''}</td>
                        <td className="order_frorm_td order_from_td_snum ">{context.description}</td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.colour}</td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.size||''}</td>
                    </tr>
                );
            case '2':
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num "><Checkbox ref={'checkall'} onChange={this.checkchange.bind(this)} checked={this.state.ischeck}/></td>

                        <td className="order_frorm_td order_from_td_cnum ">{context.productName}</td>
                        <td className="order_frorm_td order_from_td_snum ">{context.description}</td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.specification}</td>
                        <td className="order_frorm_td order_from_td_snum ">{context.prickle}</td>
                    </tr>
                );

            case '3':
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num "><Checkbox ref={'checkall'} onChange={this.checkchange.bind(this)} checked={this.state.ischeck}/></td>

                        <td className="order_frorm_td order_from_td_snum ">{context.productName}</td>
                        <td className="order_frorm_td order_from_td_snum ">{context.gramWeight}</td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.larghezza}</td>
                        <td className="order_frorm_td order_from_td_snum ">{context.specification}</td>
                        {
                          //<td className="order_frorm_td order_from_td_cnum ">{context.colour}</td>
                        }
                        <td className="order_frorm_td order_from_td_snum ">{context.yarn}</td>
                        <td className="order_frorm_td order_from_td_snum ">{context.fabricWeave}</td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.density}</td>
                    </tr>
                );
            case '4':
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num "><Checkbox ref={'checkall'} onChange={this.checkchange.bind(this)} checked={this.state.ischeck}/></td>
                        <td className="order_frorm_td order_from_td_snum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_cnum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_snum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_cnum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_snum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_cnum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_snum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_cnum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_snum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_cnum order_detail_thead_style"></td>
                        <td className="order_frorm_td order_from_td_snum order_detail_thead_style"></td>
                    </tr>
                );
            case '5':
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num "><Checkbox ref={'checkall'} onChange={this.checkchange.bind(this)} checked={this.state.ischeck}/></td>

                        <td className="order_frorm_td order_from_td_cnum ">{context.productName}</td>
                        <td className="order_frorm_td order_from_td_snum ">	{context.description}</td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.specification}</td>
                        <td className="order_frorm_td order_from_td_snum ">	{context.yarnTypes}</td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.yarnState}</td>
                        <td className="order_frorm_td order_from_td_snum ">{context.constituent}</td>
                        <td className="order_frorm_td order_from_td_cnum ">{context.yarn}</td>
                    </tr>
                );
        }
    }
}
